package com.ims.common.utils;

import com.ims.common.constant.Constants;
import com.ims.common.core.text.StrFormatter;
import org.springframework.util.AntPathMatcher;

import java.util.*;

/**
 * 各类编码生成工具类
 *
 * @author IMS
 */
public class ImCodeUtils extends org.apache.commons.lang3.StringUtils
{
    /** 空字符串 */
    private static final String NULLSTR = "";

    /** 下划线 */
    private static final char SEPARATOR = '_';

    /**
     * 获得客户编号
     */
    public static String getCustId(int count) {
        String countStr = "1000000" + count;
        return "C" + SEPARATOR + countStr.substring(4, countStr.length());
    }

    /**
     * 获得分公司编号
     */
    public static String getSiteCode(String custId, int count) {
        custId = StringUtils.isEmpty(custId) ? "X" : custId;
        String countStr = "1000000" + count;
        return "S" + SEPARATOR + custId + SEPARATOR + countStr.substring(4, countStr.length());
    }

    public static void main(String[] args) {
        System.out.println(getCustId(4));
    }
}
